package com.mak001.lite.multiSkill.GUI.Tabs;

import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Rectangle;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

public class BoneBuryTab extends JPanel{
	private static final long serialVersionUID = 1L;
	
	private JTextField textField5;
	private JComboBox bonedropDown;
	
	String[] bones = { "bones", "big", "baby dragon", " bat", "burnt",
			"fayrg ", "jorge", "monkey", "ancient ourg", "ourg", "raurg",
			"zogre", "wyvern", "wolf", "shaikahan", "dagannoth", "dragon",
			"frost dragon" };
	
	public BoneBuryTab(){
		textField5 = new JTextField();
		bonedropDown = new JComboBox();
		this.setLayout(null);

		// ---- textField5 ----
		textField5.setText("Type of Bone");
		textField5.setEditable(false);
		textField5.setHorizontalAlignment(SwingConstants.CENTER);
		this.add(textField5);
		textField5.setBounds(120, 25, 155, textField5
				.getPreferredSize().height);

		// ---- bonedropDown ----
		bonedropDown.setModel(new DefaultComboBoxModel(bones));
		this.add(bonedropDown);
		bonedropDown.setBounds(120, 50, 155, bonedropDown
				.getPreferredSize().height);

		{ // compute preferred size
			Dimension preferredSize = new Dimension();
			for (int i = 0; i < this.getComponentCount(); i++) {
				Rectangle bounds = this.getComponent(i).getBounds();
				preferredSize.width = Math.max(bounds.x + bounds.width,
						preferredSize.width);
				preferredSize.height = Math.max(bounds.y
						+ bounds.height, preferredSize.height);
			}
			Insets insets = this.getInsets();
			preferredSize.width += insets.right;
			preferredSize.height += insets.bottom;
			this.setMinimumSize(preferredSize);
			this.setPreferredSize(preferredSize);
		}
	}

	public int getBone() {
		String s = bonedropDown.getSelectedItem().toString();
		if (s.contains("big")) {
			return 532;
		} else if (s.contains("bat")) {
			return 530;
		} else if (s.contains("burnt")) {
			return 528;
		} else if (s.contains("fay")) {
			return 4830;
		} else if (s.contains("jorge")) {
			return 3125;
		} else if (s.contains("monkey")) {
			return 3183;
		} else if (s.contains("ourg")) {
			if (s.contains("ancient")) {
				return 4834;
			} else {
				return 14793;
			}
		} else if (s.contains("raurg")) {
			return 4832;
		} else if (s.contains("zorgre")) {
			return 4812;
		} else if (s.contains("wyv")) {
			return 6812;
		} else if (s.contains("wolf")) {
			return 2859;
		} else if (s.contains("shaikahan")) {
			return 3123;
		} else if (s.contains("dagannoth")) {
			return 6729;
		} else if (s.contains("dragon")) {
			if (s.contains("baby")) {
				return 534;
			} else if (s.contains("frost")) {
				return 18832;
			} else { // normal dragon bones
				return 536;
			}
		} else { // normal
			return 526;
		}
	}

	public String getBoneName() {
		return bonedropDown.getSelectedItem().toString();
	}

}
